home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Essentials / Developer Essentials Nov 90 / Apple II / Apple.II.partition / Tools / Technical.Notes / IIGS / TN.IIGS.076 < prev    next >
Encoding:
Text File  |  1990-05-29  |  6.0 KB  |  170 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. Apple IIgs
  8. #76:    Miscellaneous Resource Formats
  9.  
  10. Revised by:    C.K. Haun    May 1990
  11. Written by:    Llew Roberts & Dave Lyons    January 1990
  12.  
  13. This Technical Note describes resource structure formats for previously-
  14. unpublished types.
  15. Changes since January 1990:  Added $C001, the rRectList type.
  16. _____________________________________________________________________________
  17.  
  18.  
  19. Sampled Sound Resource (ID: $8024)
  20.  
  21. The following describes the Sampled Sound resource format.  It consists of a 
  22. ten-byte header followed by the sample data bytes.  The format is similar to 
  23. that used in File Type Notes, where the offsets, given in the form (+xxx), 
  24. determine the offset from the beginning of the resource.
  25.  
  26.     Format         (+000)    Word     This must always be zero.
  27.     Wave Size      (+002)    Word     Sample size in pages (256 
  28.                                       bytes per page).  For example, an 8K 
  29.                                       sample takes 32 pages; a 128K sample 
  30.                                       requires 200 pages.
  31.     Rel Pitch      (+004)    Word     The high byte of this word is 
  32.                                       a semitone value; the low byte is a 
  33.                                       fractional semitone.  These values 
  34.                                       are used to tune the sample to 
  35.                                       correct pitch.
  36.     Stereo         (+006)    Word     The output channel for this 
  37.                                       sound is in the low nibble of this 
  38.                                       word.
  39.     Sample rate    (+008)    Word     The sampling rate of the 
  40.                                       sound, in Hertz (Hz).
  41.     Sound          (+010)    Bytes    The sampled sound data.  
  42.                                       The bytes are all 8-bit samples.  
  43.                                       The sample starts here and continues 
  44.                                       until the end of the resource.
  45.  
  46. The resource compiler template is as follows:
  47.  
  48. #define rSoundSample    $8024
  49.  
  50. /*---------------------- rSoundSample --------------------*/
  51. type rSoundSample {
  52.     integer;        /* format */
  53.     integer;        /* wave size */
  54.     integer;        /* rel pitch */
  55.     integer;        /* stereo channel */
  56.     integer;        /* sample rate */
  57.     wide array {
  58.       hex byte;     /* raw 8 bit sound data */
  59.     };
  60. };
  61.  
  62.  
  63. Cursor Resource (ID: $8027)
  64.  
  65. The following describes the Cursor resource format:
  66.  
  67.     height         (+000)    Word     The height of the cursor, in 
  68.                                       pixels.
  69.     width          (+002)    Word     The width of the cursor, in 
  70.                                       Words.
  71.     image          (+004)    Bytes    The image of the cursor.  
  72.                                       There are height*width Words in the 
  73.                                       cursor, or twice that many Bytes.
  74.  
  75. We will call the first byte beyond the image offset "ei" for "end 
  76. of image."
  77.  
  78. mask               (+ei)     Bytes    The mask of the cursor.  This is the 
  79.                                       same size as the image.
  80.  
  81. We will call the first byte beyond the mask offset "em" for "end 
  82. of mask."
  83.  
  84. hotSpotY           (+em)    Word      The cursor's Y "hot spot."
  85. hotSpotX           (+em+2)  Word      The cursor's X "hot spot."
  86. flags              (+em+4)  Flag Word Cursor flags:
  87.                                       Bit 7: 1 = 640 Mode, 0 = 320 Mode
  88.                                       All other bits are reserved and must 
  89.                                       be zero.
  90. reserved           (+em+6)  8 Bytes   Reserved, must be zero.
  91.  
  92. The resource compiler template is as follows:
  93.  
  94. #define rCursor    $8027
  95.  
  96. /*---------------------- rCursor --------------------*/
  97. type rCursor {
  98.     height :
  99.         hex integer;         /* height */
  100.     width :
  101.         hex integer;         /* width in words */
  102.         hex string[2*$$Word(height)*$$Word(width)]; /* cursor image */
  103.         hex string[2*$$Word(height)*$$Word(width)]; /* cursor mask */
  104.         hex integer;         /* hotspot X */
  105.         hex integer;         /* hotspot Y */
  106.         hex integer;         /* flags */
  107.         hex longint = 0;     /* reserved */
  108.         hex longint = 0;     /* reserved */
  109.     };
  110. };
  111.  
  112.  
  113. Following is a simple cursor example:
  114.  
  115. resource rCursor(1,fixed) {
  116.     5,     /* height */
  117.     2,     /* width */
  118.     $"ffff0000"
  119.     $"f00f0000"
  120.     $"f00f0000"
  121.     $"f00f0000"
  122.     $"ffff0000",
  123.  
  124.     $"ffff0000"
  125.     $"ffff0000"
  126.     $"ffff0000"
  127.     $"ffff0000"
  128.     $"ffff0000",
  129.  
  130.     2,     /* hotspot Y */
  131.     2,     /* hotspot X */
  132.     $80    /* 640 mode */
  133. };
  134.  
  135. Note that the resource is marked fixed so that its handle can be dereferenced 
  136. and passed to SetCursor.
  137.  
  138.  
  139. Rectangle List Resource (ID:  $C001)
  140.  
  141. The rectangle list (type rRectList) is provided to allow an extensible, easily 
  142. modifiable collection of QuickDraw II rectangle structures.  This capability 
  143. can enhance a developer's ability to modify on-screen displays without 
  144. recompiling an entire application.  This resource also enables easier cross-
  145. development and parallel development for the Apple IIgs and the Macintosh.
  146.  
  147. The following describes the rectangle list resource format:
  148.  
  149.     count          (+000)    Word     Number of rectangles in this resource.
  150.     firstRectangle (+002)    8 Bytes  First QuickDraw II rectangle structure.
  151.     ...                               Rectangles, eight bytes each.
  152.     lastRectangle  (+002+(8*(count-1)))
  153.                              8 Bytes  Last QuickDraw II rectangle structure.
  154.  
  155. The resource compiler template is as follows:
  156.  
  157. #define rRectList    $C001
  158. type rRectList {
  159.         integer = $$Countof(RectArray);
  160.         array RectArray {
  161.             Rect;
  162.             };
  163. };
  164.  
  165.  
  166. Further Reference
  167. _____________________________________________________________________________
  168.   o  Apple IIGS Toolbox Reference, Volumes 2 & 3
  169.  
  170.